Skip to content

Conversation

@majing921201
Copy link
Contributor

@majing921201 majing921201 commented Sep 19, 2025

Switch philox_engine_inputs usage to philox_xpu_state per XPU graph request. This PR requires stock pytorch XPUGeneratorImpl PR merged.

Copilot AI review requested due to automatic review settings September 19, 2025 10:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the XPU implementation to use the new philox_xpu_state API instead of the legacy philox_engine_inputs API to support XPU graph functionality. The changes replace the old pair-based approach for Philox random number generation with a unified state object.

  • Replace philox_engine_inputs() calls with philox_xpu_state()
  • Update function signatures to use PhiloxXpuState instead of std::pair<uint64_t, uint64_t>
  • Replace philox_unpack() with at::xpu::philox::unpack()

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/ATen/native/xpu/sycl/RreluWithNoiseKernels.cpp Updates RReLU with noise kernel to use new philox state API
src/ATen/native/xpu/sycl/RandpermKernel.cpp Updates randperm kernel to use new philox state API and removes unused include
src/ATen/native/xpu/sycl/MultinomialKernel.cpp Updates multinomial kernel to use new philox state API
src/ATen/native/xpu/sycl/Dropout.cpp Updates dropout kernels to use new philox state API
src/ATen/native/xpu/sycl/Distributions.cpp Updates various distribution kernels to use new philox state API
src/ATen/native/xpu/sycl/DistributionTemplates.h Removes PhiloxState definition and updates template functions to use new API

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@majing921201 majing921201 changed the title [WIP]Change philox state API usage to support XPU graph Change philox state API usage to support XPU graph Oct 17, 2025
@gujinghui
Copy link
Contributor

I assume the existing cases already cover this change, right? @majing921201

@majing921201
Copy link
Contributor Author

I assume the existing cases already cover this change, right? @majing921201

yes

@guangyey guangyey added this pull request to the merge queue Oct 20, 2025
@guangyey
Copy link
Contributor

Try to land...

Merged via the queue into main with commit 8342cdd Oct 20, 2025
121 of 125 checks passed
@guangyey guangyey deleted the majing/rng branch October 20, 2025 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants